//
//  MoreViewController.m
//  ioschishan
//
//  Created by 马田成 on 2017/7/10.
//  Copyright © 2017年 qianyi. All rights reserved.
//

#import "MoreViewController.h"
#import "topTableViewCell.h"
#import "bottomTableViewCell.h"
#import "walletViewController.h"
#import "helpViewController.h"
#import "messageViewController.h"
#import "setupViewController.h"
#import "teacherViewController.h"
#import "ConcernAndFunsViewController.h"
#import "leftMoreViewController.h"
#import "HomeLookOverTeacherVC.h"
#import "moreTeacherViewController.h"
#import "HomeNoPicTableViewCell.h"

#import "HomeCrowdfundingViewController.h"

#import "MJRefresh.h"
#import "MJRefreshHeader.h"
#import "MJRefreshFooter.h"
#import "HomePicDetailsViewController.h"

#import "HomeCrowdfundingViewController.h"
#import "HomeOneBigPicTableViewCell.h"
#import "RemarksCellHeightModel.h"
//#import "HomeNewMorePicCell.h"
#import "HomeOneHangTableViewCell.h"
#import "HomeTwoHangTableViewCell.h"
#import "HomeThreeHangTableViewCell.h"
#import "HomeForwardOneHangCell.h"

@interface MoreViewController ()<UITableViewDelegate , UITableViewDataSource ,HomeOneBigPicCellDelegate, HomeOneHangCellDelegate, HomeTwoHangCellDelegate,HomeThreeHangCellDelegate, HomeForwardOneHangCell>{
    
    NSArray *titleArray;
    NSArray *imgArray;
    
    int mark;
    
    int circlePage;
    int crowdPage;
    int mjMark;
}

@property (nonatomic, strong) NSMutableArray *arrMu;//图片数组

// 存放cell视图展开状态的字典
@property (nonatomic, strong) NSMutableDictionary *cellIsShowAll;
@property (nonatomic, strong) NSMutableArray *dataSource;

@property (nonatomic, strong) NSMutableArray *dataArray;
@property(nonatomic,strong) NSMutableArray *teacherDataArray;
@property(nonatomic,strong) NSMutableArray *circleDataArray;
@property(nonatomic,strong) NSMutableArray *crowdDataArray;
@property(nonatomic,strong) NSMutableDictionary *memberDataDic;
@property(nonatomic,strong) UITableView *moreTableView;

@property(nonatomic,strong) UIImageView *headImg;
@property(nonatomic,strong) UILabel *nameLabel;
@property(nonatomic,strong) UILabel *focusNumLabel;
@property(nonatomic,strong) UILabel *fansNumLabel;

@property(nonatomic,strong) UILabel *introduceLabel;
@property(nonatomic,strong) UILabel *schoolLabel;
@property(nonatomic,strong) UILabel *locationLabel;

@property(nonatomic,strong) UIScrollView *sxssScrollView;
@property(nonatomic,strong) UIButton *ConcernBtn;

@property(nonatomic,strong) UIView *btnView;
@property(nonatomic,strong) UIView *btnRightView;

@end

@implementation MoreViewController

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.cellIsShowAll = [NSMutableDictionary dictionary];
    }
    return self;
}

- (void)viewWillAppear:(BOOL)animated{
    
    [self.navigationController setNavigationBarHidden:YES animated:YES];
    
    //下拉刷新
    _moreTableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
        
        mjMark = 1;
        circlePage = 1;
        crowdPage = 1;
        
        if (mark == 0) {
            
            [self requestMemberData];
            [self requestTeacherData];
            [self requestCircleData];
            
            
        }else{
        
            [self requestMemberData];
            [self requestTeacherData];
            [self requestCrowdData];
            
        }
        
        [_moreTableView.mj_header endRefreshing];
        
    }];
    
    //上拉加载
    _moreTableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
        
        mjMark = 2;
        
        if (mark == 0) {
            
            circlePage ++;
            [self requestCircleData];
            
        }else{
            
            crowdPage ++;
            [self requestCrowdData];
            
        }
        
        [_moreTableView.mj_footer endRefreshing];
        
    }];
}

- (void)viewWillDisappear:(BOOL)animated{
    
    [self.navigationController setNavigationBarHidden:NO animated:YES];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    _arrMu = [NSMutableArray array];
    _dataSource = [NSMutableArray array];
    [self initView];
    [self leftNavHide];
    [self islogin];
}

#pragma mark ----------------------- islogin ---------------------

- (void)islogin{
    
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:[[UIApplication sharedApplication]keyWindow] animated:YES];
    hud.tag = 500;
    //提示文本
    hud.labelText = @"正在加载...";
    //是否有遮罩
    hud.dimBackground = NO;
    
    NSMutableDictionary *productParams = [[NSMutableDictionary alloc]init];
    [productParams setValue: [PublicFunction getConfigWithKey:@"token"] forKey:@"token"];
    
    [[MNetworkHandler sharedInstance]conURL:login_isLogin
                                networkType:NetWorkPOST
                                     params:productParams
                                   delegate:nil
                                    showHUD:NO
                               successBlock:^(id returnData) {
                                   
                                   if ([[returnData objectForKey:@"code"]intValue] == 1) {
                                       
                                       [hud removeFromSuperview];
                                       
                                       [self requestMemberData];
                                       [self requestTeacherData];
                                       [self requestCircleData];
                                       [self requestCrowdData];
                                       
                                   }else{
                                       
                                       [hud removeFromSuperview];
                                       [PublicFunction showAlert:nil message:@"登陆过期！请重新登陆" duration:1.0f];
                                       
                                       welcomeViewController *loginCtrl = [[welcomeViewController alloc] init];
                                       UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:loginCtrl];
                                       self.view.window.rootViewController = navCtrl;
                                       self.view.window.backgroundColor = [UIColor whiteColor];
                                       [self.view.window makeKeyAndVisible];
                                   }
                                   
                               } failureBlock:^(NSError *error) {
                                   
                                   [hud removeFromSuperview];
                                   NSLog(@"%@",error);
                                   [PublicFunction showAlert:nil message:@"没有连接网络" duration:1.0f];
                               }];
}

#pragma mark ----------------------- requestData ---------------------

- (void)requestMemberData{
    
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:[[UIApplication sharedApplication]keyWindow] animated:YES];
    hud.tag = 500;
    //提示文本
    hud.labelText = @"正在加载...";
    //是否有遮罩
    hud.dimBackground = NO;
    
    NSMutableDictionary *productParams = [[NSMutableDictionary alloc]init];
    [productParams setValue: [PublicFunction getConfigWithKey:@"token"] forKey:@"token"];
    
    [[MNetworkHandler sharedInstance]conURL:more_myDataMember
                                networkType:NetWorkPOST
                                     params:productParams
                                   delegate:nil
                                    showHUD:NO
                               successBlock:^(id returnData) {
                                   
                                   if ([[returnData objectForKey:@"code"]intValue] == 1) {
                                       
                                       [hud removeFromSuperview];
                                       
                                       _memberDataDic = returnData[@"data"];
                                       NSLog(@"\n\n\n个人信息===\n\n\n%@",_memberDataDic);
                                       [_moreTableView reloadData];
                                       
                                   }else{
                                       
                                       [hud removeFromSuperview];
                                       [PublicFunction showAlert:nil message:[returnData objectForKey:@"msg"] duration:1.0f];
                                   }
                                   
                               } failureBlock:^(NSError *error) {
                                   
                                   [hud removeFromSuperview];
                                   NSLog(@"%@",error);
                                   [PublicFunction showAlert:nil message:@"没有连接网络" duration:1.0f];
                               }];
}

- (void)requestTeacherData{
    
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:[[UIApplication sharedApplication]keyWindow] animated:YES];
    hud.tag = 500;
    //提示文本
    hud.labelText = @"正在加载...";
    //是否有遮罩
    hud.dimBackground = NO;
    
    NSMutableDictionary *productParams = [[NSMutableDictionary alloc]init];
    [productParams setValue: [PublicFunction getConfigWithKey:@"token"] forKey:@"token"];
    
    [[MNetworkHandler sharedInstance]conURL:more_myDataTeacher
                                networkType:NetWorkPOST
                                     params:productParams
                                   delegate:nil
                                    showHUD:NO
                               successBlock:^(id returnData) {
                                   
                                   if ([[returnData objectForKey:@"code"]intValue] == 1) {
                                       
                                       [hud removeFromSuperview];
                                       
                                       _teacherDataArray = returnData[@"data"];
                                       NSLog(@"\n\n\n优秀教师===\n\n\n%@",_teacherDataArray);
                                       [_moreTableView reloadData];
                                       
                                   }else{
                                       
                                       [hud removeFromSuperview];
                                       [PublicFunction showAlert:nil message:[returnData objectForKey:@"msg"] duration:1.0f];
                                   }
                                   
                               } failureBlock:^(NSError *error) {
                                   
                                   [hud removeFromSuperview];
                                   NSLog(@"%@",error);
                                   [PublicFunction showAlert:nil message:@"没有连接网络" duration:1.0f];
                               }];
}

- (void)requestCircleData{
    
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:[[UIApplication sharedApplication]keyWindow] animated:YES];
    hud.tag = 500;
    //提示文本
    hud.labelText = @"正在加载...";
    //是否有遮罩
    hud.dimBackground = NO;
    
    NSMutableDictionary *productParams = [[NSMutableDictionary alloc]init];
    [productParams setValue: [PublicFunction getConfigWithKey:@"token"] forKey:@"token"];
    [productParams setValue: [NSString stringWithFormat:@"%d", circlePage] forKey:@"page"];
    
    [[MNetworkHandler sharedInstance]conURL:more_myDataCircle
                                networkType:NetWorkPOST
                                     params:productParams
                                   delegate:nil
                                    showHUD:NO
                               successBlock:^(id returnData) {
                                   
                                   if ([[returnData objectForKey:@"code"]intValue] == 1) {
                                       
                                       [hud removeFromSuperview];
                                       
                                       if (mjMark == 1) {
                                           
                                            _circleDataArray = returnData[@"data"];
                                           
                                       }else{
                                           
                                           [_circleDataArray addObjectsFromArray:returnData[@"data"]];
                                           
                                       }
                                       
                                       NSLog(@"\n\n\n我的-动态===\n\n\n%@",_circleDataArray);
                                       
                                       for (int i = 0; i<self.circleDataArray.count; i++) {
                                           
                                           NSString *str = [self.circleDataArray[i] objectForKey:@"content"];
                                           [self.dataSource addObject:str];
                                           
                                       }

                                       
                                       [_moreTableView reloadData];
                                       
                                   }else{
                                       
                                       [hud removeFromSuperview];
                                       [PublicFunction showAlert:nil message:[returnData objectForKey:@"msg"] duration:1.0f];
                                   }
                                   
                               } failureBlock:^(NSError *error) {
                                   
                                   [hud removeFromSuperview];
                                   NSLog(@"%@",error);
                                   [PublicFunction showAlert:nil message:@"没有连接网络" duration:1.0f];
                               }];
}

- (void)requestCrowdData{
    
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:[[UIApplication sharedApplication]keyWindow] animated:YES];
    hud.tag = 500;
    //提示文本
    hud.labelText = @"正在加载...";
    //是否有遮罩
    hud.dimBackground = NO;
    
    NSMutableDictionary *productParams = [[NSMutableDictionary alloc]init];
    [productParams setValue: [PublicFunction getConfigWithKey:@"token"] forKey:@"token"];
    [productParams setValue: [NSString stringWithFormat:@"%d", crowdPage] forKey:@"page"];
    
    [[MNetworkHandler sharedInstance]conURL:more_myDataCrowd
                                networkType:NetWorkPOST
                                     params:productParams
                                   delegate:nil
                                    showHUD:NO
                               successBlock:^(id returnData) {
                                   
                                   if ([[returnData objectForKey:@"code"]intValue] == 1) {
                                       
                                       [hud removeFromSuperview];
                                       
                                       if (mjMark == 1) {
                                           
                                           _crowdDataArray = returnData[@"data"];
                                           
                                       }else{
                                           
                                           [_crowdDataArray addObjectsFromArray:returnData[@"data"]];
                                           
                                       }
                                       
                                       NSLog(@"\n\n\n我的-众筹===\n\n\n%@",_crowdDataArray);
                                       [_moreTableView reloadData];
                                       
                                   }else{
                                       
                                       [hud removeFromSuperview];
                                       [PublicFunction showAlert:nil message:[returnData objectForKey:@"msg"] duration:1.0f];
                                   }
                                   
                               } failureBlock:^(NSError *error) {
                                   
                                   [hud removeFromSuperview];
                                   NSLog(@"%@",error);
                                   [PublicFunction showAlert:nil message:@"没有连接网络" duration:1.0f];
                               }];
}

#pragma mark ------------------ init -------------------

- (void)initView{
    
    _dataArray = [[NSMutableArray alloc]init];
    mjMark = 1;
    circlePage = 1;
    crowdPage = 1;
    
    titleArray = @[@"我的钱包",@"我的帮助",@"认证教师",@"设置"];
    imgArray = @[@"wallet_icon",@"my_help_icon",@"authentication_icon",@"setting_icon"];
    
    _moreTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 20, scrWidth(), scrHeight() - 49 - 20)];
    _moreTableView.backgroundColor = getColor(@"ffffff");
    _moreTableView.delegate = self;
    _moreTableView.dataSource = self;
    _moreTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [self.view addSubview:_moreTableView];
}

#pragma mark ------------------ click -------------------

- (void)concernBtnClick:(UIButton *)sender{

    UIButton *myButton1 = (UIButton *)[self.view viewWithTag:sender.tag];
    myButton1.selected = !myButton1.selected;
    
    
    NSLog(@"%ld",(long)sender.tag);
    
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:[[UIApplication sharedApplication]keyWindow] animated:YES];
    hud.tag = 500;
    //提示文本
    hud.labelText = @"正在加载...";
    //是否有遮罩
    hud.dimBackground = YES;
    
    NSMutableDictionary *productParams = [[NSMutableDictionary alloc]init];
    [productParams setValue: [PublicFunction getConfigWithKey:@"token"] forKey:@"token"];
    [productParams setValue: _teacherDataArray[sender.tag-1][@"member_id"] forKey:@"passive_member_id"];
    
    [[MNetworkHandler sharedInstance]conURL:more_follow
                                networkType:NetWorkPOST
                                     params:productParams
                                   delegate:nil
                                    showHUD:NO
                               successBlock:^(id returnData) {
                                   
                                   if ([[returnData objectForKey:@"code"]intValue] == 1) {
                                       
//                                       [PublicFunction showAlert:nil message:[returnData objectForKey:@"msg"] duration:1.0f];
                                       [hud removeFromSuperview];
                                       
                                   }else{
                                       
                                       [hud removeFromSuperview];
                                       [PublicFunction showAlert:nil message:[returnData objectForKey:@"msg"] duration:1.0f];
                                   }
                                   
                               } failureBlock:^(NSError *error) {
                                   
                                   [hud removeFromSuperview];
                                   NSLog(@"%@",error);
                                   [PublicFunction showAlert:nil message:@"没有连接网络" duration:1.0f];
                               }];
    
}

- (void)picClick{

    
}

- (void)teacherBtnClick{

    NSLog(@"查看更多");
    
    moreTeacherViewController *vc = [[moreTeacherViewController alloc]init];
    vc.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:vc animated:YES];
}

- (void)leftBtnClick{

    mark = 0;
    [_moreTableView reloadData];
}

- (void)rightBtnClick{
    
    mark = 1;
    [_moreTableView reloadData];
}

- (void)moreBtnClick{

    leftMoreViewController *vc = [[leftMoreViewController alloc]init];
    vc.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:vc animated:YES];
}

- (void)editBtnClick{

    messageViewController *vc = [[messageViewController alloc]init];
    vc.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:vc animated:YES];
}

#pragma mark -------------------- tableView ----------------------

#pragma mark --- UITableViewDelegate ---

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{

    if (section == 1) {
        
        return screenScale(44);
    }
    
    return screenScale(253 + 182);
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if (indexPath.section == 0) {
        
        return 0;
        
    }else{
    
        if (mark == 0) {
            
//            return screenScale(44);
            
            self.arrMu = [self.circleDataArray[indexPath.row] objectForKey:@"circle_pic"];
            NSMutableDictionary *dicOfFor = [[NSMutableDictionary alloc] init];
            dicOfFor = [self.circleDataArray[indexPath.row] objectForKey:@"forward_circle"];
            
            NSString *dictOfForward = [dicOfFor objectForKey:@"id"];
            
            
            if (self.arrMu.count == 1) {
                
                // 返回Cell高度
                return [RemarksCellHeightModel cellHeightWith:[self.dataSource objectAtIndex:indexPath.row] andIsShow:[[self.cellIsShowAll objectForKey:[NSString stringWithFormat:@"%ld", (long)indexPath.row]] boolValue] andLableWidth:BOUNDS.size.width-30 andFont:12 andDefaultHeight:52 andFixedHeight:42 andIsShowBtn:8] + 61 + 190 + 24 + 35;
                
            }else if (self.arrMu.count > 1 && self.arrMu.count <= 3){
                
                // 返回Cell高度
                return [RemarksCellHeightModel cellHeightWith:[self.dataSource objectAtIndex:indexPath.row] andIsShow:[[self.cellIsShowAll objectForKey:[NSString stringWithFormat:@"%ld", (long)indexPath.row]] boolValue] andLableWidth:BOUNDS.size.width-30 andFont:12 andDefaultHeight:52 andFixedHeight:42 andIsShowBtn:8] + 61 + (DEF_SCREEN_WIDTH - 48) / 3 + 28 + 35;
                
                
            }else if (self.arrMu.count > 3 && self.arrMu.count <= 6) {
                // 返回Cell高度
                return [RemarksCellHeightModel cellHeightWith:[self.dataSource objectAtIndex:indexPath.row] andIsShow:[[self.cellIsShowAll objectForKey:[NSString stringWithFormat:@"%ld", (long)indexPath.row]] boolValue] andLableWidth:BOUNDS.size.width-30 andFont:12 andDefaultHeight:52 andFixedHeight:42 andIsShowBtn:8] + 61 + (DEF_SCREEN_WIDTH - 48) / 3 * 2 + 33 + 40;
                
                
            }else if (self.arrMu.count > 6 && self.arrMu.count <= 9) {
                
                return [RemarksCellHeightModel cellHeightWith:[self.dataSource objectAtIndex:indexPath.row] andIsShow:[[self.cellIsShowAll objectForKey:[NSString stringWithFormat:@"%ld", (long)indexPath.row]] boolValue] andLableWidth:BOUNDS.size.width-30 andFont:12 andDefaultHeight:52 andFixedHeight:42 andIsShowBtn:8] + 61 + (DEF_SCREEN_WIDTH - 48) + 42 + 40;
                
            }else if ([dictOfForward length] != 0 && self.arrMu.count == 0){
                
                return [RemarksCellHeightModel cellHeightWith:[self.dataSource objectAtIndex:indexPath.row] andIsShow:[[self.cellIsShowAll objectForKey:[NSString stringWithFormat:@"%ld", (long)indexPath.row]] boolValue] andLableWidth:BOUNDS.size.width-30 andFont:12 andDefaultHeight:52 andFixedHeight:42 andIsShowBtn:8] + 61 + (DEF_SCREEN_WIDTH - 48) / 3 + 24 + 35 + 48;
                
            }else {
                
                return [RemarksCellHeightModel cellHeightWith:[self.dataSource objectAtIndex:indexPath.row] andIsShow:[[self.cellIsShowAll objectForKey:[NSString stringWithFormat:@"%ld", (long)indexPath.row]] boolValue] andLableWidth:BOUNDS.size.width-30 andFont:12 andDefaultHeight:52 andFixedHeight:42 andIsShowBtn:8] + 61 + 24 + 35;
                
                
            }
        }
        
        return screenScale(190);
    }
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if (mark == 0) {
        
        HomePicDetailsViewController *vc = [[HomePicDetailsViewController alloc] init];
        vc.hidesBottomBarWhenPushed = YES;
        vc.tieID = _circleDataArray[indexPath.row][@"id"];
        [self.navigationController pushViewController:vc animated:YES];
        
    }else{
    
        HomeCrowdfundingViewController *vc = [[HomeCrowdfundingViewController alloc] init];
        vc.crowd_id = _crowdDataArray[indexPath.row][@"crowd_id"];
        vc.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:vc animated:YES];
        
    }
    
}

- (nullable UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    
    if (section == 1) {
        
        UIView *bottomHeaderView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, scrWidth(), screenScale(44))];
        bottomHeaderView.backgroundColor = getColor(@"ffffff");
        
        ///
        
        UIButton *leftBtn = [ConfigXp buttonWithFrame:CGRectZero
                                                title:@"动态"
                                           titleColor:getColor(@"333333")
                                                 font:get4sFont(13)
                                      backgroundColor:nil
                                                image:nil];
        [leftBtn addTarget:self action:@selector(leftBtnClick) forControlEvents:UIControlEventTouchUpInside];
        [bottomHeaderView addSubview:leftBtn];
        [leftBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(bottomHeaderView).with.offset(0);
            make.left.mas_equalTo(bottomHeaderView).with.offset(screenScale(109));
            
            make.height.mas_equalTo(screenScale(44));
        }];
        
        _btnView = [[UIView alloc]init];
        _btnView.backgroundColor = getColor(@"D80A09");
        [bottomHeaderView addSubview:_btnView];
        [_btnView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(bottomHeaderView).with.offset(screenScale(36));
            make.left.mas_equalTo(bottomHeaderView).with.offset(screenScale(112));
            make.width.mas_equalTo(screenScale(24));
            make.height.mas_equalTo(screenScale(2));
        }];
        
        ///
        
        UIButton *rightBtn = [ConfigXp buttonWithFrame:CGRectZero
                                                title:@"众筹"
                                           titleColor:getColor(@"333333")
                                                 font:get4sFont(13)
                                      backgroundColor:nil
                                                image:nil];
        [rightBtn addTarget:self action:@selector(rightBtnClick) forControlEvents:UIControlEventTouchUpInside];
        [bottomHeaderView addSubview:rightBtn];
        [rightBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(bottomHeaderView).with.offset(0);
            make.left.mas_equalTo(bottomHeaderView).with.offset(screenScale(233));
            
            make.height.mas_equalTo(screenScale(44));
        }];
        
        _btnRightView = [[UIView alloc]init];
        _btnRightView.backgroundColor = getColor(@"D80A09");
        [bottomHeaderView addSubview:_btnRightView];
        [_btnRightView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(bottomHeaderView).with.offset(screenScale(36));
            make.left.mas_equalTo(bottomHeaderView).with.offset(screenScale(236));
            make.width.mas_equalTo(screenScale(24));
            make.height.mas_equalTo(screenScale(2));
        }];
        
        ///
        
        UIView *threadView = [[UIView alloc]init];
        threadView.backgroundColor = getThreadColor();
        [bottomHeaderView addSubview:threadView];
        [threadView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(bottomHeaderView.mas_bottom).with.offset(0);
            make.left.mas_equalTo(bottomHeaderView).with.offset(0);
            make.right.mas_equalTo(bottomHeaderView).with.offset(0);
            make.height.mas_equalTo(screenScale(0.5));
        }];
        
        ///
        
        if (mark == 0) {
            
            _btnView.hidden = NO;
            _btnRightView.hidden = YES;
            
        }else{
            
            _btnView.hidden = YES;
            _btnRightView.hidden = NO;
        }
        
        return bottomHeaderView;
    }
    
    //////////////////////

    UIView *headerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, scrWidth(), screenScale(253))];
    headerView.backgroundColor = getColor(@"ffffff");
    
    ///
    
    UIImageView *bgImg = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, scrWidth(), screenScale(160))];
    bgImg.userInteractionEnabled = YES;
    bgImg.image = [UIImage imageNamed:@"3479.jpg_wh1200"];
    [headerView addSubview:bgImg];
    
    UIButton *moreBtn = [ConfigXp buttonWithFrame:CGRectMake(screenScale(15), screenScale(34) - 20, screenScale(34), screenScale(18))
                                            title:@"更多"
                                       titleColor:getColor(@"ffffff")
                                             font:get4sFont(13)
                                  backgroundColor:nil
                                            image:nil];
    [moreBtn addTarget:self action:@selector(moreBtnClick) forControlEvents:UIControlEventTouchUpInside];
    [bgImg addSubview:moreBtn];
    
    UIButton *editBtn = [ConfigXp buttonWithFrame:CGRectMake(screenScale(328), screenScale(34) - 20, screenScale(34), screenScale(18))
                                            title:@"编辑"
                                       titleColor:getColor(@"ffffff")
                                             font:get4sFont(13)
                                  backgroundColor:nil
                                            image:nil];
    [editBtn addTarget:self action:@selector(editBtnClick) forControlEvents:UIControlEventTouchUpInside];
    [bgImg addSubview:editBtn];
    
    _headImg = [[UIImageView alloc]initWithFrame:CGRectMake(screenScale(15), screenScale(85), screenScale(60), screenScale(60))];
    _headImg.layer.masksToBounds = YES;
    _headImg.layer.cornerRadius = screenScale(30);
    _headImg.image = [UIImage imageNamed:@"图层-19"];
    [headerView addSubview:_headImg];
    
    _nameLabel = [ConfigXp labelWithFrame:CGRectMake(0, 0, 0, 0)
                                             text:@"没有人先生"
                                        textColor:getColor(@"ffffff")
                                             font:get4sFont(13)
                                    textAlignment:NSTextAlignmentLeft
                                  backgroundColor:[UIColor clearColor]];
    [headerView addSubview:_nameLabel];
    [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(bgImg).with.offset(screenScale(90));
        make.left.mas_equalTo(bgImg).with.offset(screenScale(90));
        
        
    }];
    
    UILabel *focusLabel = [ConfigXp labelWithFrame:CGRectZero
                                              text:@"关注"
                                         textColor:getColor(@"ffffff")
                                              font:get4sFont(11)
                                     textAlignment:NSTextAlignmentLeft
                                   backgroundColor:nil];
    [headerView addSubview:focusLabel];
    [focusLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(bgImg).with.offset(screenScale(121));
        make.left.mas_equalTo(bgImg).with.offset(screenScale(90));
        
        
    }];
    
    UIButton *buttonFocus = [[UIButton alloc] init];
    [headerView addSubview:buttonFocus];

    [buttonFocus mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(bgImg).with.offset(screenScale(121));
        make.left.mas_equalTo(bgImg).with.offset(screenScale(90));
        make.width.offset(60);
        make.height.offset(20);
        
    }];
    
    buttonFocus.backgroundColor = [UIColor clearColor];
    
    [buttonFocus addTarget:self action:@selector(focusClick) forControlEvents:UIControlEventTouchUpInside];

    
    _focusNumLabel = [ConfigXp labelWithFrame:CGRectZero
                                     text:@"438"
                                textColor:getColor(@"ffffff")
                                     font:get4sFont(11)
                            textAlignment:NSTextAlignmentLeft
                          backgroundColor:[UIColor clearColor]];
    [headerView addSubview:_focusNumLabel];
    [_focusNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(bgImg).with.offset(screenScale(121));
        make.left.mas_equalTo(focusLabel.mas_right).with.offset(screenScale(10));
        
        
    }];
    
    UIView *threadView = [[UIView alloc]initWithFrame:CGRectMake(screenScale(160), screenScale(123), screenScale(1), screenScale(13))];
    threadView.backgroundColor = getColor(@"ffffff");
    [headerView addSubview:threadView];
    
    UILabel *fans = [ConfigXp labelWithFrame:CGRectZero
                                        text:@"粉丝"
                                   textColor:getColor(@"ffffff")
                                        font:get4sFont(11)
                               textAlignment:NSTextAlignmentLeft
                             backgroundColor:nil];
    [headerView addSubview:fans];
    [fans mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(bgImg).with.offset(screenScale(121));
        make.left.mas_equalTo(threadView.mas_right).with.offset(screenScale(10));
        
        
    }];
    
    UIButton *buttonFuns = [[UIButton alloc] init];
    [headerView addSubview:buttonFuns];
    
    [buttonFuns mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(bgImg).with.offset(screenScale(121));
        make.left.mas_equalTo(fans).with.offset(screenScale(1));
        make.width.offset(60);
        make.height.offset(20);
        
    }];
    
    buttonFuns.backgroundColor = [UIColor clearColor];
    [buttonFuns addTarget:self action:@selector(funsClick) forControlEvents:UIControlEventTouchUpInside];
    
    _fansNumLabel = [ConfigXp labelWithFrame:CGRectZero
                                        text:@"518"
                                   textColor:getColor(@"ffffff")
                                        font:get4sFont(11)
                               textAlignment:NSTextAlignmentLeft
                             backgroundColor:[UIColor clearColor]];
    [headerView addSubview:_fansNumLabel];
    [_fansNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(bgImg).with.offset(screenScale(121));
        make.left.mas_equalTo(fans.mas_right).with.offset(screenScale(10));
        
        
    }];
    
    ///
    
    _introduceLabel = [ConfigXp labelWithFrame:CGRectZero
                                          text:[_nameLabel.text stringByAppendingString:@"的个人简介"]
                                     textColor:getColor(@"9b9b9b")
                                          font:get4sFont(10)
                                 textAlignment:NSTextAlignmentLeft
                               backgroundColor:[UIColor clearColor]];
    [bgImg addSubview:_introduceLabel];
    [_introduceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(bgImg.mas_bottom).with.offset(screenScale(15));
        make.left.mas_equalTo(bgImg).with.offset(screenScale(15));
        
        
    }];
    
    _schoolLabel = [ConfigXp labelWithFrame:CGRectZero
                                          text:@"学校： 省实验中学"
                                     textColor:getColor(@"9b9b9b")
                                          font:get4sFont(10)
                                 textAlignment:NSTextAlignmentLeft
                               backgroundColor:nil];
    [bgImg addSubview:_schoolLabel];
    [_schoolLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(bgImg.mas_bottom).with.offset(screenScale(36));
        make.left.mas_equalTo(bgImg).with.offset(screenScale(15));
        
        
    }];
    
    _locationLabel = [ConfigXp labelWithFrame:CGRectZero
                                       text:@"所在地： 沈阳"
                                  textColor:getColor(@"9b9b9b")
                                       font:get4sFont(10)
                              textAlignment:NSTextAlignmentLeft
                            backgroundColor:nil];
    [bgImg addSubview:_locationLabel];
    [_locationLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(bgImg.mas_bottom).with.offset(screenScale(57));
        make.left.mas_equalTo(bgImg).with.offset(screenScale(15));
        
        
    }];
    
    UIView *bottomThread = [[UIView alloc]init];
    bottomThread.backgroundColor = getColor(@"f5f5f5");
    [headerView addSubview:bottomThread];
    [bottomThread mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(headerView.mas_bottom).with.offset(0);
        make.left.mas_equalTo(bgImg).with.offset(0);
        make.width.mas_equalTo(scrWidth());
        make.height.mas_equalTo(screenScale(8));
    }];
    
    ///
    
    UIView *threadVIew = [[UIView alloc]init];
    threadVIew.backgroundColor = [UIColor colorWithRed:245 / 255.0f green:245 / 255.0f blue:245 / 255.0f alpha:1];
    [headerView addSubview:threadVIew];
    [threadVIew mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(headerView).with.offset(screenScale(225) + 20);
        make.left.mas_equalTo(bgImg).with.offset(0);
        make.width.mas_equalTo(scrWidth());
        make.height.mas_equalTo(screenScale(44));
    }];
    
    UIImageView *teacherImg = [[UIImageView alloc]init];
    teacherImg.image = [UIImage imageNamed:@"teacher_icon"];
    [threadVIew addSubview:teacherImg];
    [teacherImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(threadVIew).with.offset(screenScale(16));
        make.left.mas_equalTo(bgImg).with.offset(screenScale(15));
        make.width.mas_equalTo(screenScale(19));
        make.height.mas_equalTo(screenScale(15));
    }];
    
    UILabel *teacherLabel = [ConfigXp labelWithFrame:CGRectZero
                                                text:@"优秀教师"
                                           textColor:getColor(@"333333")
                                                font:get4sFont(12)
                                       textAlignment:NSTextAlignmentLeft
                                     backgroundColor:[UIColor clearColor]];
    [threadVIew addSubview:teacherLabel];
    [teacherLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(threadVIew).with.offset(screenScale(15));
        make.left.mas_equalTo(bgImg).with.offset(screenScale(39));
        
        
    }];
    
    UIButton *teacherBtn = [ConfigXp buttonWithFrame:CGRectZero
                                               title:@"查看更多"
                                          titleColor:getColor(@"9b9b9b")
                                                font:get4sFont(12)
                                     backgroundColor:nil
                                               image:nil];
    [teacherBtn addTarget:self action:@selector(teacherBtnClick) forControlEvents:UIControlEventTouchUpInside];
    [threadVIew addSubview:teacherBtn];
    [teacherBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(threadVIew).with.offset(0);
        make.right.mas_equalTo(bgImg).with.offset(screenScale(-30));
        
        make.height.mas_equalTo(screenScale(44));
    }];
    
    UIImageView *teacherRightImg = [[UIImageView alloc]init];
    teacherRightImg.image = [UIImage imageNamed:@"arrow_icon"];
    [threadVIew addSubview:teacherRightImg];
    [teacherRightImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(threadVIew).with.offset(screenScale(16));
        make.right.mas_equalTo(bgImg).with.offset(screenScale(-15));
        make.width.mas_equalTo(screenScale(12));
        make.height.mas_equalTo(screenScale(12));
    }];
    
    ///
    
    if ([_teacherDataArray count] > 0) {
        
        self.sxssScrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, screenScale(269) + 20, DEF_SCREEN_WIDTH, screenScale(138))];
        self.sxssScrollView.contentSize=CGSizeMake(screenScale(120)*[_teacherDataArray count],screenScale(138));
        self.sxssScrollView.backgroundColor=[UIColor colorWithRed:245 / 255.0f green:245 / 255.0f blue:245 / 255.0f alpha:1];
        self.sxssScrollView.showsHorizontalScrollIndicator=NO;
        self.sxssScrollView.pagingEnabled = NO;
        [headerView addSubview:self.sxssScrollView];
        
        for (int i = 0; i < [_teacherDataArray count]; i++) {
            
            UIView *viewOfRoot = [[UIView alloc] init];
            [self.sxssScrollView addSubview:viewOfRoot];
            viewOfRoot.frame = CGRectMake(screenScale(120)*i, 0, screenScale(120), screenScale(122));
            
            UIView *viewOfWhite = [[UIView alloc] init];
            [viewOfRoot addSubview:viewOfWhite];
            viewOfWhite.backgroundColor = [UIColor whiteColor];
            [viewOfWhite mas_makeConstraints:^(MASConstraintMaker *make) {
                make.top.equalTo(viewOfRoot).with.offset(screenScale(25));
                make.left.equalTo(viewOfRoot).with.offset(screenScale(8));
                make.right.equalTo(viewOfRoot).with.offset(screenScale(-7));
                make.bottom.equalTo(viewOfRoot).with.offset(0);
            }];
            
            UIButton *buttonOfHeaderPic = [[UIButton alloc] init];
            [viewOfRoot addSubview:buttonOfHeaderPic];
            [buttonOfHeaderPic addTarget:self action:@selector(picClick) forControlEvents:UIControlEventTouchUpInside];
            [buttonOfHeaderPic setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
            [buttonOfHeaderPic mas_makeConstraints:^(MASConstraintMaker *make) {
                make.top.equalTo(self.sxssScrollView).with.offset(0);
                make.centerX.equalTo(viewOfRoot.mas_centerX);
                make.height.offset(screenScale(50));
                make.width.offset(screenScale(50));
            }];
            UIImageView *headerImg = [[UIImageView alloc]init];
            headerImg.layer.masksToBounds = YES;
            headerImg.layer.cornerRadius = screenScale(25);
            [viewOfRoot addSubview:headerImg];
            [headerImg mas_makeConstraints:^(MASConstraintMaker *make) {
                make.top.equalTo(self.sxssScrollView).with.offset(0);
                make.centerX.equalTo(viewOfRoot.mas_centerX);
                make.height.offset(screenScale(50));
                make.width.offset(screenScale(50));
            }];
            
            NSString *urlN = manage(AP_HOST, _teacherDataArray[i][@"header_img"]);
            NSURL *urlW = [NSURL URLWithString:urlN];
            [headerImg sd_setImageWithURL:urlW placeholderImage:[UIImage imageNamed:@"niunai"]];
            
            
            UILabel *labelOfName = [[UILabel alloc] init];
            labelOfName.text = _teacherDataArray[i][@"user_name"];
            [viewOfWhite addSubview:labelOfName];
            labelOfName.font = get4sFont(12);
            labelOfName.textColor = [UIColor blackColor];
            [labelOfName mas_makeConstraints:^(MASConstraintMaker *make) {
                make.top.equalTo(buttonOfHeaderPic.mas_bottom).with.offset(screenScale(10));
                make.centerX.equalTo(viewOfWhite.mas_centerX);
                make.height.offset(13);
                
            }];
            
            self.ConcernBtn = [[UIButton alloc] init];
            self.ConcernBtn.titleLabel.font = get4sFont(12);
            self.ConcernBtn.layer.cornerRadius = 2.0f;
            self.ConcernBtn.layer.masksToBounds = YES;
            self.ConcernBtn.layer.borderWidth = 1.0f;
            self.ConcernBtn.tag = i+1;
            [self.ConcernBtn setTitle:@"已关注" forState:UIControlStateNormal];
            [self.ConcernBtn setTitle:@"关注" forState:UIControlStateSelected];
            self.ConcernBtn.selected = YES;
            self.ConcernBtn.layer.borderColor = [UIColor colorWithRed:255.0f / 255.0f green:65 / 255.0f blue:94 / 255.0f alpha:1].CGColor;
            [self.ConcernBtn addTarget:self action:@selector(concernBtnClick:) forControlEvents:UIControlEventTouchUpInside];
            [self.ConcernBtn setTitleColor:[UIColor colorWithRed:255.0f / 255.0f green:65 / 255.0f blue:94 / 255.0f alpha:1] forState:UIControlStateNormal];
            [viewOfWhite addSubview:self.ConcernBtn];
            [self.ConcernBtn mas_makeConstraints:^(MASConstraintMaker *make) {
                make.top.equalTo(labelOfName.mas_bottom).with.offset(screenScale(10));
                make.centerX.equalTo(viewOfWhite.mas_centerX);
                make.height.offset(screenScale(24));
                make.width.offset(screenScale(80));
            }];
        }
    }
    
    ///
    
    NSString *urlN1 = manage(AP_HOST, _memberDataDic[@"member"][@"back_img"]);
    NSURL *urlW1 = [NSURL URLWithString:urlN1];
    [bgImg sd_setImageWithURL:urlW1 placeholderImage:[UIImage imageNamed:@"3479.jpg_wh1200"]];
    
    NSString *urlN = manage(AP_HOST, _memberDataDic[@"member"][@"header_img"]);
    NSURL *urlW = [NSURL URLWithString:urlN];
    [_headImg sd_setImageWithURL:urlW placeholderImage:[UIImage imageNamed:@"图层-19"]];
    
    _nameLabel.text = _memberDataDic[@"member"][@"user_name"];
    _focusNumLabel.text = [NSString stringWithFormat:@"%@",_memberDataDic[@"follow"]];
    _fansNumLabel.text = _memberDataDic[@"follow_cover"];
    
    if (_memberDataDic) {
        
        _locationLabel.text = [@"所在地：" stringByAppendingString:_memberDataDic[@"school_location"]];
        _schoolLabel.text = [@"学校：" stringByAppendingString:_memberDataDic[@"school"]];
        
    }
    
    _introduceLabel.text = _memberDataDic[@"member"][@"content"];
    
    ///
    
    return headerView;
}

#pragma mark --- UITableViewDataSource ---

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{

    return 2;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    if (section == 0) {
        
        return 0;
        
    }else{
    
        if (mark == 0) {
            
            return _circleDataArray.count;
            
        }else{
            
            return _crowdDataArray.count;
        }
    }
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if (indexPath.section == 1) {
        
        if (mark == 0) {
            
            NSMutableDictionary *dict1 = self.circleDataArray[indexPath.row];
            //  self.dataSource = [self.dataArr[indexPath.row] objectForKey:@"content"];
            NSMutableDictionary *dicOfFor = [[NSMutableDictionary alloc] init];
            dicOfFor = [self.circleDataArray[indexPath.row] objectForKey:@"forward_circle"];
            
            NSString *dictOfForward = [dicOfFor objectForKey:@"id"];
            self.arrMu = [self.circleDataArray[indexPath.row] objectForKey:@"circle_pic"];
            
            
            if (self.arrMu.count ==1) {
                
                static NSString *cellName = @"meTableViewCell";
                HomeOneBigPicTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellName];
                
                if (!cell) {
                    cell = [[HomeOneBigPicTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellName];
                    cell.delegate = self;
                    cell.selectionStyle = UITableViewCellSelectionStyleNone;
                }
                [cell setCellContent:[self.dataSource objectAtIndex:indexPath.row] andIsShow:[[self.cellIsShowAll objectForKey:[NSString stringWithFormat:@"%ld", (long)indexPath.row]] boolValue]  andCellIndexPath:indexPath];
                
                cell.selectionStyle = UITableViewCellSelectionStyleNone;
                cell.infolable.text =[dict1 objectForKey:@"user_name"];
                
                if ([[dict1 objectForKey:@"every_num"] isEqualToString:@"0"]) {
                    
                    cell.blueView.hidden = YES;
                    
                }else {
                    cell.blueView.hidden = NO;
                    NSString *str = @"+";
                    cell.labelWater.text =[[str stringByAppendingString:[dict1 objectForKey:@"every_num"]] stringByAppendingString:@"水滴"];
                    
                }
                
                if ([[dict1 objectForKey:@"member_type"] isEqualToString:@"1"]) {
                    cell.labelTeacher.text = @"普通";
                }else if ([[dict1 objectForKey:@"member_type"] isEqualToString:@"2"]){
                    cell.labelTeacher.text = @"老师";
                    
                }else if ([[dict1 objectForKey:@"member_type"] isEqualToString:@"3"]){
                    cell.labelTeacher.text = @"大V";
                    
                }else {
                    
                    cell.labelTeacher.text = @"官方";
                }
                
                
                
                cell.labelOfTime.text = [dict1 objectForKey:@"add_time"];
                cell.labelHymnNum.text = [dict1 objectForKey:@"up"];
                cell.labelComment.text = [dict1 objectForKey:@"comment"];
                //            NSString *strRead = @"阅读";
                NSString *str = [dict1 objectForKey:@"reading"];
                cell.labelRead.text = [str stringByAppendingString:@"阅读"];
                
                NSString *urlHeaderPic = manage(AP_HOST, [dict1 objectForKey:@"header_img"]);
                [cell.headImage sd_setImageWithURL:[NSURL URLWithString:urlHeaderPic] placeholderImage:[UIImage imageNamed:@""]];
                
                NSString *urlVpPic1 = manage(AP_HOST, [self.arrMu[0] objectForKey:@"pic"]);
                
                [cell.picImage sd_setImageWithURL:[NSURL URLWithString:urlVpPic1] placeholderImage:[UIImage imageNamed:@""]];
                
                cell.picImage.contentMode = UIViewContentModeScaleAspectFill;
                cell.picImage.clipsToBounds = YES;
                cell.picImage.userInteractionEnabled = YES;
                
                
                
                return cell;
            }else if (self.arrMu.count > 1 && self.arrMu.count <= 3){
                
                static NSString *cellName = @"HomeOneHangTableViewCell";
                HomeOneHangTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellName];
                if (!cell) {
                    cell = [[HomeOneHangTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellName];
                    cell.delegate = self;
                    cell.selectionStyle = UITableViewCellSelectionStyleNone;
                }
                [cell setCellContent:[self.dataSource objectAtIndex:indexPath.row] andIsShow:[[self.cellIsShowAll objectForKey:[NSString stringWithFormat:@"%ld", (long)indexPath.row]] boolValue]  andCellIndexPath:indexPath];
                
                cell.selectionStyle = UITableViewCellSelectionStyleNone;
                cell.infolable.text =[dict1 objectForKey:@"user_name"];
                if ([[dict1 objectForKey:@"every_num"] isEqualToString:@"0"]) {
                    
                    cell.blueView.hidden = YES;
                    
                }else {
                    cell.blueView.hidden = NO;
                    NSString *str = @"+";
                    cell.labelWater.text =[[str stringByAppendingString:[dict1 objectForKey:@"every_num"]] stringByAppendingString:@"水滴"];
                    
                    
                }
                if ([[dict1 objectForKey:@"member_type"] isEqualToString:@"1"]) {
                    cell.labelTeacher.text = @"普通";
                }else if ([[dict1 objectForKey:@"member_type"] isEqualToString:@"2"]){
                    cell.labelTeacher.text = @"老师";
                    
                }else if ([[dict1 objectForKey:@"member_type"] isEqualToString:@"3"]){
                    cell.labelTeacher.text = @"大V";
                    
                }else {
                    
                    cell.labelTeacher.text = @"官方";
                }
                
                cell.labelOfTime.text = [dict1 objectForKey:@"add_time"];
                cell.labelHymnNum.text = [dict1 objectForKey:@"up"];
                cell.labelComment.text = [dict1 objectForKey:@"comment"];
                //            NSString *strRead = @"阅读";
                NSString *str = [dict1 objectForKey:@"reading"];
                cell.labelRead.text = [str stringByAppendingString:@"阅读"];
                
                NSString *urlHeaderPic = manage(AP_HOST, [dict1 objectForKey:@"header_img"]);
                [cell.headImage sd_setImageWithURL:[NSURL URLWithString:urlHeaderPic] placeholderImage:[UIImage imageNamed:@""]];
                
                if (self.arrMu.count == 2) {
                    
                    NSString *urlVpPic1 = manage(AP_HOST, [self.arrMu[0] objectForKey:@"pic"]);
                    
                    [cell.picImage1 sd_setImageWithURL:[NSURL URLWithString:urlVpPic1] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage1.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage1.clipsToBounds = YES;
                    cell.picImage1.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic2 = manage(AP_HOST, [self.arrMu[1] objectForKey:@"pic"]);
                    
                    [cell.picImage2 sd_setImageWithURL:[NSURL URLWithString:urlVpPic2] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage2.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage2.clipsToBounds = YES;
                    cell.picImage2.userInteractionEnabled = YES;
                    cell.picImage3.hidden = YES;
                    
                }else {
                    
                    NSString *urlVpPic1 = manage(AP_HOST, [self.arrMu[0] objectForKey:@"pic"]);
                    
                    [cell.picImage1 sd_setImageWithURL:[NSURL URLWithString:urlVpPic1] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage1.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage1.clipsToBounds = YES;
                    cell.picImage1.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic2 = manage(AP_HOST, [self.arrMu[1] objectForKey:@"pic"]);
                    
                    [cell.picImage2 sd_setImageWithURL:[NSURL URLWithString:urlVpPic2] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage2.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage2.clipsToBounds = YES;
                    cell.picImage2.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic3 = manage(AP_HOST, [self.arrMu[2] objectForKey:@"pic"]);
                    
                    [cell.picImage3 sd_setImageWithURL:[NSURL URLWithString:urlVpPic3] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage3.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage3.clipsToBounds = YES;
                    cell.picImage3.userInteractionEnabled = YES;
                    
                }
                
                return cell;
                
                
                
            }else if (self.arrMu.count > 3 && self.arrMu.count <= 6){
                
                static NSString *cellName = @"HomeTwoHangTableViewCell";
                HomeTwoHangTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellName];
                if (!cell) {
                    cell = [[HomeTwoHangTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellName];
                    cell.delegate = self;
                    cell.selectionStyle = UITableViewCellSelectionStyleNone;
                }
                [cell setCellContent:[self.dataSource objectAtIndex:indexPath.row] andIsShow:[[self.cellIsShowAll objectForKey:[NSString stringWithFormat:@"%ld", (long)indexPath.row]] boolValue]  andCellIndexPath:indexPath];
                
                cell.selectionStyle = UITableViewCellSelectionStyleNone;
                cell.infolable.text =[dict1 objectForKey:@"user_name"];
                if ([[dict1 objectForKey:@"every_num"] isEqualToString:@"0"]) {
                    
                    cell.blueView.hidden = YES;
                    
                }else {
                    cell.blueView.hidden = NO;
                    NSString *str = @"+";
                    cell.labelWater.text =[[str stringByAppendingString:[dict1 objectForKey:@"every_num"]] stringByAppendingString:@"水滴"];
                    
                    
                }
                cell.labelOfTime.text = [dict1 objectForKey:@"add_time"];
                cell.labelHymnNum.text = [dict1 objectForKey:@"up"];
                cell.labelComment.text = [dict1 objectForKey:@"comment"];
                //            NSString *strRead = @"阅读";
                NSString *str = [dict1 objectForKey:@"reading"];
                cell.labelRead.text = [str stringByAppendingString:@"阅读"];
                
                NSString *urlHeaderPic = manage(AP_HOST, [dict1 objectForKey:@"header_img"]);
                [cell.headImage sd_setImageWithURL:[NSURL URLWithString:urlHeaderPic] placeholderImage:[UIImage imageNamed:@""]];
                
                if (self.arrMu.count == 4) {
                    
                    NSString *urlVpPic1 = manage(AP_HOST, [self.arrMu[0] objectForKey:@"pic"]);
                    
                    [cell.picImage1 sd_setImageWithURL:[NSURL URLWithString:urlVpPic1] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage1.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage1.clipsToBounds = YES;
                    cell.picImage1.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic2 = manage(AP_HOST, [self.arrMu[1] objectForKey:@"pic"]);
                    
                    [cell.picImage2 sd_setImageWithURL:[NSURL URLWithString:urlVpPic2] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage2.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage2.clipsToBounds = YES;
                    cell.picImage2.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic3 = manage(AP_HOST, [self.arrMu[2] objectForKey:@"pic"]);
                    
                    [cell.picImage3 sd_setImageWithURL:[NSURL URLWithString:urlVpPic3] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage3.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage3.clipsToBounds = YES;
                    cell.picImage3.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic4 = manage(AP_HOST, [self.arrMu[3] objectForKey:@"pic"]);
                    
                    [cell.picImage4 sd_setImageWithURL:[NSURL URLWithString:urlVpPic4] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage4.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage4.clipsToBounds = YES;
                    cell.picImage4.userInteractionEnabled = YES;
                    
                    cell.picImage5.hidden = YES;
                    cell.picImage6.hidden = YES;
                    
                    
                    
                    
                }else if (self.arrMu.count == 5) {
                    
                    NSString *urlVpPic1 = manage(AP_HOST, [self.arrMu[0] objectForKey:@"pic"]);
                    
                    [cell.picImage1 sd_setImageWithURL:[NSURL URLWithString:urlVpPic1] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage1.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage1.clipsToBounds = YES;
                    cell.picImage1.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic2 = manage(AP_HOST, [self.arrMu[1] objectForKey:@"pic"]);
                    
                    [cell.picImage2 sd_setImageWithURL:[NSURL URLWithString:urlVpPic2] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage2.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage2.clipsToBounds = YES;
                    cell.picImage2.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic3 = manage(AP_HOST, [self.arrMu[2] objectForKey:@"pic"]);
                    
                    [cell.picImage3 sd_setImageWithURL:[NSURL URLWithString:urlVpPic3] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage3.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage3.clipsToBounds = YES;
                    cell.picImage3.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic4 = manage(AP_HOST, [self.arrMu[3] objectForKey:@"pic"]);
                    
                    [cell.picImage4 sd_setImageWithURL:[NSURL URLWithString:urlVpPic4] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage4.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage4.clipsToBounds = YES;
                    cell.picImage4.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic5 = manage(AP_HOST, [self.arrMu[4] objectForKey:@"pic"]);
                    
                    [cell.picImage5 sd_setImageWithURL:[NSURL URLWithString:urlVpPic5] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage5.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage5.clipsToBounds = YES;
                    cell.picImage5.userInteractionEnabled = YES;
                    
                    cell.picImage6.hidden = YES;
                    
                }else {
                    NSString *urlVpPic1 = manage(AP_HOST, [self.arrMu[0] objectForKey:@"pic"]);
                    
                    [cell.picImage1 sd_setImageWithURL:[NSURL URLWithString:urlVpPic1] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage1.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage1.clipsToBounds = YES;
                    cell.picImage1.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic2 = manage(AP_HOST, [self.arrMu[1] objectForKey:@"pic"]);
                    
                    [cell.picImage2 sd_setImageWithURL:[NSURL URLWithString:urlVpPic2] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage2.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage2.clipsToBounds = YES;
                    cell.picImage2.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic3 = manage(AP_HOST, [self.arrMu[2] objectForKey:@"pic"]);
                    
                    [cell.picImage3 sd_setImageWithURL:[NSURL URLWithString:urlVpPic3] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage3.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage3.clipsToBounds = YES;
                    cell.picImage3.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic4 = manage(AP_HOST, [self.arrMu[3] objectForKey:@"pic"]);
                    
                    [cell.picImage4 sd_setImageWithURL:[NSURL URLWithString:urlVpPic4] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage4.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage4.clipsToBounds = YES;
                    cell.picImage4.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic5 = manage(AP_HOST, [self.arrMu[4] objectForKey:@"pic"]);
                    
                    [cell.picImage5 sd_setImageWithURL:[NSURL URLWithString:urlVpPic5] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage5.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage5.clipsToBounds = YES;
                    cell.picImage5.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic6 = manage(AP_HOST, [self.arrMu[5] objectForKey:@"pic"]);
                    
                    [cell.picImage6 sd_setImageWithURL:[NSURL URLWithString:urlVpPic6] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage6.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage6.clipsToBounds = YES;
                    cell.picImage6.userInteractionEnabled = YES;
                    
                }
                
                
                return cell;
                
            }else if (self.arrMu.count > 6 && self.arrMu.count <= 9){
                static NSString *cellName = @"HomeThreeHangTableViewCell";
                HomeThreeHangTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellName];
                if (!cell) {
                    cell = [[HomeThreeHangTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellName];
                    cell.delegate = self;
                    cell.selectionStyle = UITableViewCellSelectionStyleNone;
                }
                [cell setCellContent:[self.dataSource objectAtIndex:indexPath.row] andIsShow:[[self.cellIsShowAll objectForKey:[NSString stringWithFormat:@"%ld", (long)indexPath.row]] boolValue]  andCellIndexPath:indexPath];
                
                cell.selectionStyle = UITableViewCellSelectionStyleNone;
                cell.infolable.text =[dict1 objectForKey:@"user_name"];
                if ([[dict1 objectForKey:@"every_num"] isEqualToString:@"0"]) {
                    
                    cell.blueView.hidden = YES;
                    
                }else {
                    cell.blueView.hidden = NO;
                    NSString *str = @"+";
                    cell.labelWater.text =[[str stringByAppendingString:[dict1 objectForKey:@"every_num"]] stringByAppendingString:@"水滴"];
                    
                    
                }
                
                if ([[dict1 objectForKey:@"member_type"] isEqualToString:@"1"]) {
                    cell.labelTeacher.text = @"普通";
                }else if ([[dict1 objectForKey:@"member_type"] isEqualToString:@"2"]){
                    cell.labelTeacher.text = @"老师";
                    
                }else if ([[dict1 objectForKey:@"member_type"] isEqualToString:@"3"]){
                    cell.labelTeacher.text = @"大V";
                    
                }else {
                    
                    cell.labelTeacher.text = @"官方";
                }
                
                cell.labelOfTime.text = [dict1 objectForKey:@"add_time"];
                cell.labelHymnNum.text = [dict1 objectForKey:@"up"];
                cell.labelComment.text = [dict1 objectForKey:@"comment"];
                //            NSString *strRead = @"阅读";
                NSString *str = [dict1 objectForKey:@"reading"];
                cell.labelRead.text = [str stringByAppendingString:@"阅读"];
                
                NSString *urlHeaderPic = manage(AP_HOST, [dict1 objectForKey:@"header_img"]);
                [cell.headImage sd_setImageWithURL:[NSURL URLWithString:urlHeaderPic] placeholderImage:[UIImage imageNamed:@""]];
                
                if (self.arrMu.count == 7) {
                    
                    NSString *urlVpPic1 = manage(AP_HOST, [self.arrMu[0] objectForKey:@"pic"]);
                    
                    [cell.picImage1 sd_setImageWithURL:[NSURL URLWithString:urlVpPic1] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage1.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage1.clipsToBounds = YES;
                    cell.picImage1.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic2 = manage(AP_HOST, [self.arrMu[1] objectForKey:@"pic"]);
                    
                    [cell.picImage2 sd_setImageWithURL:[NSURL URLWithString:urlVpPic2] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage2.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage2.clipsToBounds = YES;
                    cell.picImage2.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic3 = manage(AP_HOST, [self.arrMu[2] objectForKey:@"pic"]);
                    
                    [cell.picImage3 sd_setImageWithURL:[NSURL URLWithString:urlVpPic3] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage3.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage3.clipsToBounds = YES;
                    cell.picImage3.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic4 = manage(AP_HOST, [self.arrMu[3] objectForKey:@"pic"]);
                    
                    [cell.picImage4 sd_setImageWithURL:[NSURL URLWithString:urlVpPic4] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage4.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage4.clipsToBounds = YES;
                    cell.picImage4.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic5 = manage(AP_HOST, [self.arrMu[4] objectForKey:@"pic"]);
                    
                    [cell.picImage5 sd_setImageWithURL:[NSURL URLWithString:urlVpPic5] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage5.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage5.clipsToBounds = YES;
                    cell.picImage5.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic6 = manage(AP_HOST, [self.arrMu[5] objectForKey:@"pic"]);
                    
                    [cell.picImage6 sd_setImageWithURL:[NSURL URLWithString:urlVpPic6] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage6.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage6.clipsToBounds = YES;
                    cell.picImage6.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic7 = manage(AP_HOST, [self.arrMu[6] objectForKey:@"pic"]);
                    
                    [cell.picImage7 sd_setImageWithURL:[NSURL URLWithString:urlVpPic7] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage7.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage7.clipsToBounds = YES;
                    cell.picImage7.userInteractionEnabled = YES;
                    cell.picImage8.hidden = YES;
                    cell.picImage9.hidden = YES;
                    
                    
                    
                    
                }else if (self.arrMu.count == 8) {
                    
                    NSString *urlVpPic1 = manage(AP_HOST, [self.arrMu[0] objectForKey:@"pic"]);
                    
                    [cell.picImage1 sd_setImageWithURL:[NSURL URLWithString:urlVpPic1] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage1.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage1.clipsToBounds = YES;
                    cell.picImage1.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic2 = manage(AP_HOST, [self.arrMu[1] objectForKey:@"pic"]);
                    
                    [cell.picImage2 sd_setImageWithURL:[NSURL URLWithString:urlVpPic2] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage2.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage2.clipsToBounds = YES;
                    cell.picImage2.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic3 = manage(AP_HOST, [self.arrMu[2] objectForKey:@"pic"]);
                    
                    [cell.picImage3 sd_setImageWithURL:[NSURL URLWithString:urlVpPic3] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage3.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage3.clipsToBounds = YES;
                    cell.picImage3.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic4 = manage(AP_HOST, [self.arrMu[3] objectForKey:@"pic"]);
                    
                    [cell.picImage4 sd_setImageWithURL:[NSURL URLWithString:urlVpPic4] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage4.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage4.clipsToBounds = YES;
                    cell.picImage4.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic5 = manage(AP_HOST, [self.arrMu[4] objectForKey:@"pic"]);
                    
                    [cell.picImage5 sd_setImageWithURL:[NSURL URLWithString:urlVpPic5] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage5.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage5.clipsToBounds = YES;
                    cell.picImage5.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic6 = manage(AP_HOST, [self.arrMu[5] objectForKey:@"pic"]);
                    
                    [cell.picImage6 sd_setImageWithURL:[NSURL URLWithString:urlVpPic6] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage6.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage6.clipsToBounds = YES;
                    cell.picImage6.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic7 = manage(AP_HOST, [self.arrMu[6] objectForKey:@"pic"]);
                    
                    [cell.picImage7 sd_setImageWithURL:[NSURL URLWithString:urlVpPic7] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage7.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage7.clipsToBounds = YES;
                    cell.picImage7.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic8 = manage(AP_HOST, [self.arrMu[7] objectForKey:@"pic"]);
                    
                    [cell.picImage8 sd_setImageWithURL:[NSURL URLWithString:urlVpPic8] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage8.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage8.clipsToBounds = YES;
                    cell.picImage8.userInteractionEnabled = YES;
                    
                    cell.picImage9.hidden = YES;
                    
                    
                    
                }else {
                    NSString *urlVpPic1 = manage(AP_HOST, [self.arrMu[0] objectForKey:@"pic"]);
                    
                    [cell.picImage1 sd_setImageWithURL:[NSURL URLWithString:urlVpPic1] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage1.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage1.clipsToBounds = YES;
                    cell.picImage1.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic2 = manage(AP_HOST, [self.arrMu[1] objectForKey:@"pic"]);
                    
                    [cell.picImage2 sd_setImageWithURL:[NSURL URLWithString:urlVpPic2] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage2.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage2.clipsToBounds = YES;
                    cell.picImage2.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic3 = manage(AP_HOST, [self.arrMu[2] objectForKey:@"pic"]);
                    
                    [cell.picImage3 sd_setImageWithURL:[NSURL URLWithString:urlVpPic3] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage3.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage3.clipsToBounds = YES;
                    cell.picImage3.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic4 = manage(AP_HOST, [self.arrMu[3] objectForKey:@"pic"]);
                    
                    [cell.picImage4 sd_setImageWithURL:[NSURL URLWithString:urlVpPic4] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage4.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage4.clipsToBounds = YES;
                    cell.picImage4.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic5 = manage(AP_HOST, [self.arrMu[4] objectForKey:@"pic"]);
                    
                    [cell.picImage5 sd_setImageWithURL:[NSURL URLWithString:urlVpPic5] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage5.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage5.clipsToBounds = YES;
                    cell.picImage5.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic6 = manage(AP_HOST, [self.arrMu[5] objectForKey:@"pic"]);
                    
                    [cell.picImage6 sd_setImageWithURL:[NSURL URLWithString:urlVpPic6] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage6.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage6.clipsToBounds = YES;
                    cell.picImage6.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic7 = manage(AP_HOST, [self.arrMu[6] objectForKey:@"pic"]);
                    
                    [cell.picImage7 sd_setImageWithURL:[NSURL URLWithString:urlVpPic7] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage7.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage7.clipsToBounds = YES;
                    cell.picImage7.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic8 = manage(AP_HOST, [self.arrMu[7] objectForKey:@"pic"]);
                    
                    [cell.picImage8 sd_setImageWithURL:[NSURL URLWithString:urlVpPic8] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage8.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage8.clipsToBounds = YES;
                    cell.picImage8.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic9 = manage(AP_HOST, [self.arrMu[8] objectForKey:@"pic"]);
                    
                    [cell.picImage9 sd_setImageWithURL:[NSURL URLWithString:urlVpPic9] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage9.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage9.clipsToBounds = YES;
                    cell.picImage9.userInteractionEnabled = YES;
                    
                    
                    
                }
                
                
                return cell;
                
            }else if ([dictOfForward length] != 0 && self.arrMu.count == 0){
                
                static NSString *cellName = @"HomeForwardOneHangCell";
                HomeForwardOneHangCell *cell = [tableView dequeueReusableCellWithIdentifier:cellName];
                if (!cell) {
                    cell = [[HomeForwardOneHangCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellName];
                    cell.delegate = self;
                    cell.selectionStyle = UITableViewCellSelectionStyleNone;
                }
                [cell setCellContent:[self.dataSource objectAtIndex:indexPath.row] andIsShow:[[self.cellIsShowAll objectForKey:[NSString stringWithFormat:@"%ld", (long)indexPath.row]] boolValue]  andCellIndexPath:indexPath];
                
                cell.selectionStyle = UITableViewCellSelectionStyleNone;
                cell.infolable.text =[dict1 objectForKey:@"user_name"];
                if ([[dict1 objectForKey:@"every_num"] isEqualToString:@"0"]) {
                    
                    cell.blueView.hidden = YES;
                    
                }else {
                    cell.blueView.hidden = NO;
                    NSString *str = @"+";
                    cell.labelWater.text =[[str stringByAppendingString:[dict1 objectForKey:@"every_num"]] stringByAppendingString:@"水滴"];
                    
                    
                }
                
                if ([[dict1 objectForKey:@"member_type"] isEqualToString:@"1"]) {
                    cell.labelTeacher.text = @"普通";
                }else if ([[dict1 objectForKey:@"member_type"] isEqualToString:@"2"]){
                    cell.labelTeacher.text = @"老师";
                    
                }else if ([[dict1 objectForKey:@"member_type"] isEqualToString:@"3"]){
                    cell.labelTeacher.text = @"大V";
                    
                }else {
                    
                    cell.labelTeacher.text = @"官方";
                }
                
                
                cell.labelOfTime.text = [dict1 objectForKey:@"add_time"];
                cell.labelHymnNum.text = [dict1 objectForKey:@"up"];
                cell.labelComment.text = [dict1 objectForKey:@"comment"];
                //            NSString *strRead = @"阅读";
                NSString *str = [dict1 objectForKey:@"reading"];
                cell.labelRead.text = [str stringByAppendingString:@"阅读"];
                
                NSString *urlHeaderPic = manage(AP_HOST, [dict1 objectForKey:@"header_img"]);
                [cell.headImage sd_setImageWithURL:[NSURL URLWithString:urlHeaderPic] placeholderImage:[UIImage imageNamed:@""]];
                
                NSMutableDictionary *dictOfward = [dict1 objectForKey:@"forward_circle"];
                cell.titleLabel.text = [dictOfward objectForKey:@"content"];
                cell.nameLabel.text =[dictOfward objectForKey:@"forward_username"];
                NSMutableArray *arrOfPic = [NSMutableArray array];
                arrOfPic = [dictOfward objectForKey:@"forward_pic"];
                
                if (arrOfPic.count == 1) {
                    
                    NSString *urlVpPic1 = manage(AP_HOST, [arrOfPic[0] objectForKey:@"pic"]);
                    
                    [cell.picImage1 sd_setImageWithURL:[NSURL URLWithString:urlVpPic1] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage1.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage1.clipsToBounds = YES;
                    cell.picImage1.userInteractionEnabled = YES;
                    
                    
                    cell.picImage2.hidden = YES;
                    cell.picImage3.hidden = YES;
                    
                    
                }else if (arrOfPic.count ==2){
                    NSString *urlVpPic1 = manage(AP_HOST, [arrOfPic[0] objectForKey:@"pic"]);
                    
                    [cell.picImage1 sd_setImageWithURL:[NSURL URLWithString:urlVpPic1] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage1.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage1.clipsToBounds = YES;
                    cell.picImage1.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic2 = manage(AP_HOST, [arrOfPic[1] objectForKey:@"pic"]);
                    
                    [cell.picImage2 sd_setImageWithURL:[NSURL URLWithString:urlVpPic2] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage2.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage2.clipsToBounds = YES;
                    cell.picImage2.userInteractionEnabled = YES;
                    cell.picImage3.hidden = YES;
                    
                }else {
                    
                    NSString *urlVpPic1 = manage(AP_HOST, [arrOfPic[0] objectForKey:@"pic"]);
                    
                    [cell.picImage1 sd_setImageWithURL:[NSURL URLWithString:urlVpPic1] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage1.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage1.clipsToBounds = YES;
                    cell.picImage1.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic2 = manage(AP_HOST, [arrOfPic[1] objectForKey:@"pic"]);
                    
                    [cell.picImage2 sd_setImageWithURL:[NSURL URLWithString:urlVpPic2] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage2.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage2.clipsToBounds = YES;
                    cell.picImage2.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic3 = manage(AP_HOST, [arrOfPic[2] objectForKey:@"pic"]);
                    
                    [cell.picImage3 sd_setImageWithURL:[NSURL URLWithString:urlVpPic3] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.picImage3.contentMode = UIViewContentModeScaleAspectFill;
                    cell.picImage3.clipsToBounds = YES;
                    cell.picImage3.userInteractionEnabled = YES;
                    
                    
                }
                
                
                
                return cell;
                
            }else {
                
                static NSString *cellName = @"HomeNoPicTableViewCell";
                HomeNoPicTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellName];
                if (!cell) {
                    cell = [[HomeNoPicTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellName];
                    cell.delegate = self;
                    cell.selectionStyle = UITableViewCellSelectionStyleNone;
                }
                [cell setCellContent:[self.dataSource objectAtIndex:indexPath.row] andIsShow:[[self.cellIsShowAll objectForKey:[NSString stringWithFormat:@"%ld", (long)indexPath.row]] boolValue]  andCellIndexPath:indexPath];
                
                cell.selectionStyle = UITableViewCellSelectionStyleNone;
                cell.infolable.text =[dict1 objectForKey:@"user_name"];
                if ([[dict1 objectForKey:@"every_num"] isEqualToString:@"0"]) {
                    
                    cell.blueView.hidden = YES;
                    
                }else {
                    cell.blueView.hidden = NO;
                    NSString *str = @"+";
                    cell.labelWater.text =[[str stringByAppendingString:[dict1 objectForKey:@"every_num"]] stringByAppendingString:@"水滴"];
                    
                    
                }
                
                if ([[dict1 objectForKey:@"member_type"] isEqualToString:@"1"]) {
                    cell.labelTeacher.text = @"普通";
                }else if ([[dict1 objectForKey:@"member_type"] isEqualToString:@"2"]){
                    cell.labelTeacher.text = @"老师";
                    
                }else if ([[dict1 objectForKey:@"member_type"] isEqualToString:@"3"]){
                    cell.labelTeacher.text = @"大V";
                    
                }else {
                    
                    cell.labelTeacher.text = @"官方";
                }
                
                
                cell.labelOfTime.text = [dict1 objectForKey:@"add_time"];
                cell.labelHymnNum.text = [dict1 objectForKey:@"up"];
                cell.labelComment.text = [dict1 objectForKey:@"comment"];
                //            NSString *strRead = @"阅读";
                NSString *str = [dict1 objectForKey:@"reading"];
                cell.labelRead.text = [str stringByAppendingString:@"阅读"];
                
                NSString *urlHeaderPic = manage(AP_HOST, [dict1 objectForKey:@"header_img"]);
                [cell.headImage sd_setImageWithURL:[NSURL URLWithString:urlHeaderPic] placeholderImage:[UIImage imageNamed:@""]];
                
                
                
                return cell;
                
            }
            
            
        }
        
        [tableView registerClass:[bottomTableViewCell class] forCellReuseIdentifier:@"bottomTableViewCell"];
        bottomTableViewCell *cell = (bottomTableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"bottomTableViewCell" forIndexPath:indexPath];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        
        NSString *urlN = manage(AP_HOST, _crowdDataArray[indexPath.row][@"pic"]);
        NSURL *urlW = [NSURL URLWithString:urlN];
        [cell.leftImg sd_setImageWithURL:urlW placeholderImage:[UIImage imageNamed:@"niunai"]];
        
        
        cell.leftImg.contentMode = UIViewContentModeScaleAspectFill;
        cell.leftImg.clipsToBounds = YES;
        
        
        cell.nameLable.text = _crowdDataArray[indexPath.row][@"title"];
        
        cell.textLable.text = _crowdDataArray[indexPath.row][@"content"];
        
        [cell.progressView setProgress:[_crowdDataArray[indexPath.row][@"money"] floatValue] / [_crowdDataArray[indexPath.row][@"target"] floatValue] animated:YES];

//        [cell.progressView setProgress:30.0 / 100.0 animated:YES];
        
        cell.progressLable.text = [[NSString stringWithFormat:@"%.0f",[_crowdDataArray[indexPath.row][@"money"] floatValue] / [_crowdDataArray[indexPath.row][@"target"] floatValue]*100] stringByAppendingString:@"%"];
        
        NSString *urlN1 = manage(AP_HOST, _crowdDataArray[indexPath.row][@"header_img"]);
        NSURL *urlW1 = [NSURL URLWithString:urlN1];
        [cell.headImg sd_setImageWithURL:urlW1 placeholderImage:[UIImage imageNamed:@"niunai"]];
        
        cell.personLable.text = _crowdDataArray[indexPath.row][@"user_name"];
        
        cell.moneyLable.text = _crowdDataArray[indexPath.row][@"target"];
        
        cell.peopleLable.text = _crowdDataArray[indexPath.row][@"support"];
        
        cell.dayLable.text = _crowdDataArray[indexPath.row][@"days"];
        
        return cell;
    }
    
    [tableView registerClass:[bottomTableViewCell class] forCellReuseIdentifier:@"bottomTableViewCell"];
    bottomTableViewCell *cell = (bottomTableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"bottomTableViewCell" forIndexPath:indexPath];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return cell;
}
//关注
- (void)focusClick{
    
    ConcernAndFunsViewController *vc = [[ConcernAndFunsViewController alloc] init];
    vc.hidesBottomBarWhenPushed = YES;
    vc.indexID = 0;
    [self.navigationController pushViewController:vc animated:YES];
    
}
- (void)funsClick{
    
    ConcernAndFunsViewController *vc = [[ConcernAndFunsViewController alloc] init];
    vc.hidesBottomBarWhenPushed = YES;
    vc.indexID = 1;
    [self.navigationController pushViewController:vc animated:YES];
    
}

#pragma mark -- Dalegate

- (void)remarksCellShowContrntWithDic:(NSDictionary *)dic andCellIndexPath:(NSIndexPath *)indexPath{
    
    [self.cellIsShowAll setObject:[dic objectForKey:@"isShow"] forKey:[NSString stringWithFormat:@"%@",[dic objectForKey:@"row"]]];
    
    [_moreTableView reloadData];
    
}

//- (NSMutableArray *)photoDeleSource{
//    if (!_arrMu) {
//        _arrMu = [NSMutableArray array];
//    }
//    return  _arrMu;
//}

@end
